<?php

namespace log;

/**
 * Common data types used in the logs classes.
 */
class LogCommon
{
    /**
     * Log format regular expression.
     * Format:
     *  |timestamp|host|module|file|line|function|procid
     *  |threadid|sysusr|type|msg|
     * Required:
     *  timestamp, host, module, procid, sysusr, type, msg.
     * @note required fields could not be empty.
     * @warning DO NOT CHANGE IT!
     */
    const logFormatRegEx = "^\\|[0-9]{10}
                             \\|[\\w. -]{4,256}
                             \\|[0-8]{1,4}
                             \\|([\\w. /-]{4,256}|)
                             \\|[0-9]{0,4}
                             \\|([\\w.\\(\\)*:,& -]{4,256}|)
                             \\|[0-9]{1,6}
                             \\|[0-9]{1,6}
                             \\|[\\w. -]{1,256}
                             \\|[0-8]{1,4}
                             \\|{.*}\\|$";

    const logWebrootWs       = 0;
    const logWebrootHtml     = 1;
    const logCommon          = 2;
    const logInventory       = 3;
    const logPersistance     = 4;
    const logSession         = 5;
    public static $logModuleStr = array(
        'webrootws', 'webroothtml', 'common', 'inventory',
        'persistance', 'session'
    );

    const logTypeCritical   = 0;
    const logTypeError      = 1;
    const logTypeWarning    = 2;
    const logTypeNotice     = 3;
    const logTypeDebug      = 4;
    const logTypeStackTrace = 5;
    const logTypeAudit      = 6;
    const logTypeSecurity   = 7;
    public static $logTypeStr = array(
        'critical', 'error', 'warning', 'notice',
        'debug', 'stackTrace', 'audit', 'security'
    );
}
